TON block

Short summary

Name

TON

→POU type

→function block

Category

IEC-block, Timer

Conform to →IEC-standard

(tick) no restrictions, but: (info) implementer-specific realization; see "Functionality"

Graphical interface

Available since

version 1.4.1 (for Neuron Power Engineer)

Functionality

This is an edge delay where the turning-on edge is delayed.

Enter the delay period at input PT. If input IN is →turned on and the delay period is over, output Q returns value TRUE (or an equivalent). Output ET returns the expired time since turning input IN on, until the value entered at PT is reached and as long as the input IN is turned on.

Implementer-specific realization

The IEC-standard does not specify whether and how to consider changes for input PT while the functionality is executed. In Neuron Power Engineer, the expired time is always compared with the current value of PT. Thus, if input PT is changed after input IN has been turned on, the behavior of the block is affected.

This block receives the current system time from the runtime system. This time remains constant while the same task is executed. However, in case of different tasks, it is possible that a different system time is used when the belonging programs are executed (even if the different tasks have the same cycle time).

The following illustration shows the behavior of TON:

In-/outputs

 

Identifier

→Data type

Description

Inputs:

IN

BOOL

input/start

PT

TIME

preset time

Outputs:

Q

BOOL

output

ET

TIME

elapsed time

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

Simple call of TON
PROGRAM Test
    VAR
        ton1      : TON;
        elapsed   : BOOL;
    END_VAR
    ton1(IN := TRUE, PT := T#2s, Q => elapsed);
    (* Instance of block 'TON' is called. Variable 'elapsed' is set to TRUE after 2 seconds. *)
END_PROGRAM
Timer program with call of TON
PROGRAM Timer
    VAR
        ton1     : TON;
        count    : INT;
        duration : TIME;
        ton_q    : BOOL;
        temp     : BOOL;
        trigger  : BOOL;
    END_VAR
    
    duration := T#2s;
    temp := NOT(ton_q);
    trigger := AND(temp, TRUE);
    ton1(IN := trigger, PT := duration, Q => ton_q);   (* Instance of block 'TON' is called.  *)
    count := ADD(EN := ton_q, IN1 := count, IN2 := 1);
END_PROGRAM

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See: